package Tree;

public class item108 {
}
class Solution108 {
    public static TreeNode sortedArrayToBST(int[] nums) {
        // 思路：先找到中间位置i，nums[i-1]作为左子树，num[i+1]作为右子树
        int len = nums.length;
        int start = 0;
        int end = len-1;
        if(len==0) return null;
        TreeNode node=null;
        TreeNode root = build(nums, start, end);

        return null;
    }

    private static TreeNode build(int[] nums, int start, int end) {

        if(start>end)
        {
            return null;
        }
        int mid = (start+end)/2;
        TreeNode root =  new TreeNode(nums[mid]);
        root.left = build(nums,start,mid-1);
        root.right = build(nums, mid+1, end);
        return root;
    }

    public static void main(String[] args) {
        int [] nums = {-10,-3,0,5,9};
        sortedArrayToBST(nums);
    }
}